<template>
  <div class="watch">
    <header>
      <div class="header_one">
        <span @click="goback">
          <van-icon name="arrow-left" />
        </span>
        <span>关注列表</span>
        <span>
          <van-icon name="more-o" />
        </span>
      </div>
    </header>
    <main>
      <div class="watch_list" v-for="(item,index) in list" :key="index">
        <img :src="item.img1" alt @click="detail1(item.id)" />
        <div>
          <p class="watch_list_one">
            <span>{{item.name}}</span>
            <span class="my_button" @click="del(item.id)">已关注</span>
          </p>
          <p>{{item.word}}</p>
        </div>
      </div>
    </main>
  </div>
</template>

<script>
import axios from "../../utils/request";
export default {
  data() {
    return {
      list: []
      //   liked: false,
      //   content: "+关注",
      //   bg_color: "#fef0f0",
      //   ft_color: "#f56c6c"
    };
  },
  created() {
    this.getlist();
  },
  methods: {
    getlist() {
      axios({
        url: "/api/addlists",
        method: "post"
      }).then(res => {
        console.log(res);
        this.list = res.data.data;
      });
    },
    goback() {
      this.$router.go(-1);
    },

    detail1(id) {
      this.$router.push(`/pay/` + id);
    },
    del(id) {
      axios({
        url: "/api/watchdel",
        method: "delete",
        data: {
          id: id
        }
      }).then(res=>{
        this.getlist()
      })
    }
  }
};
</script>

<style scoped>
.watch {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
header {
  height: 115px;
}
.header_one {
  height: 115px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0px 30px;
  font-size: 22px;
  color: #f3f9ff;
  content: "";
  background: linear-gradient(45deg, #0f7ef4, #1988f6, #34a0fd);
}
main {
  flex: 1;
  overflow-y: auto;
}
.watch_list {
  width: 100%;
  height: 70px;
  /* border: 1px solid #000; */
  border-bottom: 1px solid #f0eeee;
  display: flex;
  align-items: center;
  margin-top: 10px;
}
.watch_list img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin-left: 10px;
}
.watch_list div {
  margin-left: 10px;
}
.watch_list div p {
  line-height: -20px;
}
.watch_list div p:nth-child(1) {
  margin-top: 8px;
}
/* .watch_list_one span:nth-child(2){
    width: 50px;
    height: 20px;
    display: inline-block;
    border: 1px solid #cccccc;
    color: #cccccc;
    margin-left: 70px;
    text-align: center;
    line-height: 20px;
} */
.my_button {
  width: 100px;
  height: 40px;
  display: inline-block;
  margin-left: 70px;
  text-align: center;
  line-height: 20px;
  color: #f56c6c;
  background: #fef0f0;
  border: 1px solid #fbc4c4;
  border-radius: 20px;
  padding: 12px 23px;
  text-align: center;
  font-size: 16px;
  -webkit-transform: scale(0.7);
}
</style>